﻿using System;
using System.Collections.Generic;
using Missbot.Service;
using MongoDB.Bson.Serialization.Attributes;

namespace Missbot.AIModule.Vip
{
    public class VipSvcPurchaseRecord : DbBaseEntity
    {
        public string UserID { get; init; }

        public string SvcName { get; init; }

        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime PurchaseTime { get; init; }

        public int Diamonds { get; set; }
    }

    public static class VipSvcPurchaseDA
    {
        public static void Insert(this VipSvcPurchaseRecord entity)
        {
            MongoService<VipSvcPurchaseRecord>.Insert(entity);
        }

        public static List<VipSvcPurchaseRecord> Get(string UserID, string ArmerName, DateTime startDate, DateTime endDate)
        {
            return MongoService<VipSvcPurchaseRecord>.Get(p => p.UserID == UserID && p.SvcName == ArmerName && p.PurchaseTime > startDate && p.PurchaseTime <= endDate);
        }
    }
}